package com.abl.controller.system;

import com.abl.common.security.annotation.ResC;
import com.abl.common.security.annotation.ResM;
import com.abl.domain.model.Param;
import com.abl.domain.model.SRS;
import com.abl.controller.BaseController;
import com.abl.service.system.SysRoleService;
import com.alibaba.fastjson2.JSONObject;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@ResC("角色管理")
@Tag(name = "角色管理")
@RestController
@RequestMapping("/system/role")
public class SysRoleController extends BaseController {
    @Autowired
    private SysRoleService service;

    @ResM("新增")
    @PostMapping({"/add"})
    public SRS<Object> add(@RequestBody Param<JSONObject> param) {
        return SRS.bySuccess(service.add(param));
    }

//    @ApiM("根据已有角色复制新增")
//    @PostMapping({"/copyAndAdd"})
//    public SRS<Object> copyAndAdd(@RequestBody Param<JSONObject> param) {
//        return SRS.bySuccess(service.copyAndAdd(param));
//    }

    @ResM("删除")
    @PostMapping({"/del"})
    public SRS<Object> del(@RequestBody Param<JSONObject> param) {
        return SRS.bySuccess(service.del(param));
    }

    @ResM("修改")
    @PostMapping({"/edit"})
    public SRS<Object> edit(@RequestBody Param<JSONObject> param) {
        return SRS.bySuccess(service.edit(param));
    }

    @ResM("修改角色权限")
    @PostMapping({"/editApi"})
    public SRS<Object> editApi(@RequestBody Param<JSONObject> param) {
        return SRS.bySuccess(service.editApi(param));
    }

    @ResM("查询集合")
    @PostMapping({"/list"})
    public SRS<Object> list(@RequestBody Param<JSONObject> param) {
        return SRS.bySuccess(service.list(param));
    }


    @ResM("模糊查询条件下拉列表")
    @PostMapping({"/searchInput"})
    public SRS<Object> searchInput(@RequestBody Param<JSONObject> param) {
        return SRS.bySuccess(service.searchInput(param));
    }

    @ResM("查询角色拥有的权限")
    @PostMapping("/roleRes")
    public SRS<Object> roleRes(@RequestBody Param<JSONObject> param) {
        return SRS.bySuccess(service.roleRes(param));
    }

    @ResM("查询全部菜单和角色具备的菜单")
    @PostMapping("/roleMenu")
    public SRS<Object> roleMenu(@RequestBody Param<JSONObject> param) {
        return SRS.bySuccess(service.roleMenu(param));
    }


//
//    @ApiM("修改角色菜单")
//    @PostMapping("/editRoleMenu")
//    public SRS<Object> editRoleMenu(@RequestBody Param<JSONObject> param) {
//        return SRS.bySuccess(service.editRoleMenu(param));
//    }
//
//    @ApiM("角色对应全部功能")
//    @PostMapping("/roleMenuFun")
//    public SRS<Object> roleMenuFun(@RequestBody Param<JSONObject> param) {
//        return SRS.bySuccess(service.roleMenuFun(param));
//    }
//
//    @ApiM("修改角色对应功能关联关系")
//    @PostMapping("/editRoleMenuFun")
//    public SRS<Object> editRoleMenuFun(@RequestBody Param<JSONObject> param) {
//        return SRS.bySuccess(service.editRoleMenuFun(param));
//    }
}
